package com.lmpop.frame.util;

import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class RandomID
{
  public String GenTradeId()
  {
    String tradeId = "";
    RandomStrg.setCharset("a-zA-Z0-9");
    RandomStrg.setLength("15");
    try {
      RandomStrg.generateRandomObject();
      tradeId = RandomStrg.getRandom();
    } catch (Exception e) {
      System.out.println("e = " + e.toString());
    }
    return tradeId;
  }

  public String GenWebId() {
    String tradeId = "";
    RandomStrg.setCharset("0-9");
    RandomStrg.setLength("10");
    try {
      RandomStrg.generateRandomObject();
      tradeId = RandomStrg.getRandom();
    } catch (Exception e) {
      System.out.println("e = " + e.toString());
    }
    return tradeId;
  }

  public String GenOrderId() {
    Calendar c = Calendar.getInstance(Locale.CHINA);
    Date d = c.getTime();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    return sdf.format(d) + (int)(Math.random() * 10.0D);
  }
}